package ZuoYe6_DuoChongXunHuan_0424;

public class ZuoYe1_ZhiShu {

	public static void main(String[] args) {
		// 1:输出1-10000以内所有的质数并统计个数
		int flag = 0, a = 0;
		for (int i = 1; i <= 10000; i++) {
			for (int j = 1; j <= i; j++) {
				if (i % j == 0) {
					flag++;
				}
			}
			if (flag == 2) {
				System.out.println(i + "是质数");
				a++;
			}
			flag = 0;
		}
		System.out.println("共有" + a + "个质数。");

	}

}
